#define _CRT_SECURE_NO_WARNINGS 1

#include "TopK.h"

void TopkTest()
{
	int* a = (int*)malloc(100000 * sizeof(int));
	if (NULL == a)
	{
		exit(-1);
	}

	for (int i = 0; i < 100000; i++)
	{
		a[i] = rand() % 10000;
	}

	a[123] = 10000 + 1;
	a[234] = 10000 + 2;
	a[1034] = 10000 + 3;
	a[2367] = 10000 + 4;
	a[4678] = 10000 + 5;
	a[5828] = 10000 + 6;
	a[8754] = 10000 + 7;
	a[10832] = 10000 + 8;
	a[46729] = 10000 + 9;
	a[78201] = 10000 + 10;

	TopkPrint(a, 100000, 10);

	free(a);
	a = NULL;
}

void TestHeap()
{
	HP hp;
	HeapInit(&hp);

	int a[] = { 23,45,22,46,17 };
	int sz = sizeof(a) / sizeof(a[0]);
	for (int i = 0; i < sz; i++)
	{
		HeapPush(&hp, a[i]);
	}

	HeapDestroy(&hp);
}

int main()
{
	//TestHeap();
	srand((unsigned int)time(NULL));
	TopkTest();
	return 0;
}